﻿
Public Class PhimDAO
    Public Shared Sub themPhim(ByVal phim As PhimDTO)
        Dim sql As String = "insert into PHIM(MaPhim,TenPhim,MaTheLoai,TomTat) values('" + phim.maPhim + "',N'" + phim.tenPhim + _
            "','" + phim.maTheLoai + "',N'" + phim.tomTat + "')"
        DataProvider.ExcuteQuery(sql)
    End Sub
    Public Shared Function loadPhim() As DataTable
        Dim sql As String = "select * from PHIM"
        Dim dt As New DataTable
        dt = DataProvider.DataTable(sql)
        Return dt
    End Function
    Public Shared Sub CapNhatPhim(ByVal phim As PhimDTO)
        Dim sql As String = "update PHIM set TenPhim=N'" + phim.tenPhim + "', MaTheLoai='" + phim.maTheLoai + "', TomTat=N'" + phim.tomTat + "' where MaPhim='" + phim.maPhim + "'"
        DataProvider.ExcuteQuery(sql)
    End Sub

    Public Shared Sub xoaPhim(ByVal phim As PhimDTO)
        Dim sql As String = "delete from PHIM where MaPhim='" + phim.maPhim + "'"
        DataProvider.ExcuteQuery(sql)
    End Sub
End Class
